package com.itheima.servlet;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


@WebServlet("/filterServlet")
public class FilterServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) {
        doGet(request, response);
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) {
        try {
            //获取前端的请求参数
            String username = request.getParameter("username");
            //返回给前端数据
            response.getWriter().print(username);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
